package edu.hbsi.demo2;


abstract class Pen {
    protected String color;
    protected int length;

    // 默认构造函数
    public Pen() {
        this.color = "Black";
        this.length = 10;
    }

    // 只有一个字符串型参数color的构造函数
    public Pen(String color) {
        this.color = color;
        this.length = 10;
    }

    // 只有一个数值型参数length的构造函数
    public Pen(int length) {
        this.color = "Black";
        this.length = length;
    }

    // 有两个参数color和length的构造函数
    public Pen(String color, int length) {
        this.color = color;
        this.length = length;
    }

    // 方法display()用于输出Pen的详细信息
    public void display() {
        System.out.println("Pen Color: " + color + ", Length: " + length);
    }

    // 抽象方法draw()
    abstract void draw();
}
